package com.enation.app.javashop.api.client;

import com.enation.app.javashop.service.payment.RefundManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * 支付中心退款client实现
 *
 * @author fk
 * @version v7.0
 * @date 20/3/9 下午3:51
 * @since v7.2.1
 */
@RestController
@RequestMapping("/client/payment")
@Validated
@ApiIgnore
public class RefundClientController {


    @Autowired
    private RefundManager refundManager;


    @RequestMapping(value = "/origin-refund",method = RequestMethod.POST)
    public Map originRefund(String returnTradeNo, String refundSn, Double refundPrice, String subType) {
        return refundManager.originRefund(returnTradeNo, subType + refundSn, refundPrice);
    }

    @RequestMapping(value = "/origin-refund/status",method = RequestMethod.GET)
    public String queryRefundStatus(String returnTradeNo, String refundSn,String subType) {
        return refundManager.queryRefundStatus(returnTradeNo,subType + refundSn);
    }


}
